package com.xuecheng.content.api;

import com.xuecheng.content.model.dto.CoursePreviewDto;
import com.xuecheng.content.service.CoursePublishService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Tang
 * @version 1.0
 * @date 2024/1/6 13:08
 */
@Slf4j
@RestController
@RequestMapping("/open")
public class CourseOpenController {
    private final CoursePublishService coursePublishService;
    public CourseOpenController(CoursePublishService coursePublishService) {
        this.coursePublishService = coursePublishService;
    }

    @GetMapping("/course/whole/{courseId}")
    public CoursePreviewDto courseTeachplanInfo(@PathVariable("courseId") Long courseId) {
        return coursePublishService.getCoursePreviewInfo(courseId);
    }
}
